#include <iostream>
#include <Windows.h>
#include "Slaves/Motorized/StepperPump/StepperPump.hpp"

using namespace std;

int main()
{
	GeneralSlave configSlave;

	{
		configSlave._meta.platform = L"terrydr";
		// standard esp32 module with CP210x interface
		//configSlave._comm.appearance = L"USB\\VID_10C4&PID_EA60&REV_0100";
		// arduino micro
		configSlave._comm.appearance = L"USB\\VID_2341&PID_8037&REV_0100&MI_00";

		configSlave._meta.model = L"LittleMotor";
		configSlave._comm.identifier = L"tester";

		configSlave._comm.connectionType = L"usb";
		configSlave._comm.connectionSubType = L"";

		configSlave._comm.coordinatorIndex = -1;
		//configSlave._meta.scriptedName = profileUniSlave.nameInScript;
		configSlave._meta.referenceName = L"any_name";

		configSlave._meta.controlFunctions = L"";
		configSlave._meta.controlParameters = L"";
		configSlave._meta.controlModes.paraMap.clear();

		configSlave._comm.connectionHardware = L"";
		configSlave._comm._conStat = GeneralSlave::ConnectionStatus::Missing;
		if (configSlave._meta.model.length() > 0) {
			configSlave._meta.isExpecting = true;
		}
	}


	StepperPumpSlave slave(&configSlave);
	slave.debug_testConfirm();
	int cnnResult = slave.connect(0);

	vector<float>position;
	position.push_back(10); position.push_back(0); position.push_back(20); position.push_back(33);
	int mask = 0b1101;
	slave.moveToPosition(0b1101, position);
	for (int loopIdx = 0; loopIdx < 10; loopIdx++) {
		slave.readOut();
		wcout << slave.getCurCoordStr() << endl;
		Sleep(100);
		if (slave.getActionStr().compare(L"Idle") == 0) {

		}
	}

	return 0;
}